//
//  ACEBaseViewController.m
//  ACE
//
//  Created by zhangtao on 2018/8/7.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACEBaseViewController.h"
#import "AppDelegate.h"
@interface ACEBaseViewController ()

@end

@implementation ACEBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
}

-(void)showLeftHome{
    NSString *image = @"";
    if ([ACEPublicTool currentRoleIsStudent]) {
        image = @"返回";
    }else{
        image = @"Rectangle 2 Copy";
    }
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(leftBackHomeClick)];
    
    
    [item setTag:leftItemClick];
    self.navigationItem.leftBarButtonItem = item;
}

-(void)leftBackHomeClick{
    AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
    [app jumpToCourseController];
}


-(void)initNavRightWithImage:(NSString *)imageName{
    UIBarButtonItem *item = [self createNavItemWithImage:imageName];
    [item setTag:rightItemClick];
    self.navigationItem.rightBarButtonItem = item;
}

-(UIBarButtonItem *)createNavItemWithImage:(NSString *)image{
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(itemClick:)];
    return item;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
